#include "DataRepo.hpp"
#include "Message.hpp"
#include <boost/asio.hpp>


using boost::asio::ip::udp;

class Connection_End_Server_UDP
{
public:

		typedef std::map< int, MsgPointer > ID_MSGPOINTER;

		Connectiontype	m_Entity;
		int				m_ConnectionID;
		int				m_LastMessageID;
		//DataRepo&		m_dataRepo;
		udp::endpoint	remote_endpoint_;
		boost::asio::io_service& m_io_service_;
		std::string		m_ServerName;
		ID_MSGPOINTER	m_NonAckMessages;
		bool m_bIsConnected ;



	typedef boost::shared_ptr<Connection_End_Server_UDP> ConnectionEnd_Server_Pointer;

	//boost::asio::io_service& io_service ,
	Connection_End_Server_UDP( int connectionID, udp::endpoint& ep , boost::asio::io_service& io , std::string Name ): remote_endpoint_( ep ),m_io_service_( io )
	{

		m_bIsConnected = false ; //Because we instantiate this when calling "Connect to other Servers",
								 //will set it to true at acknowledgenent of the Entity message.

		m_ConnectionID = connectionID;
		std::cout<<"Instantiating a new instance of Connection_end with ID"<< m_ConnectionID <<std::endl;
		m_Entity = SERVER;
		m_LastMessageID = 0 ;
		m_ServerName = Name;
		std::cout<<"Leaving Connection_End_Server_UDP Constructor \n";

	}


};
